package com.luhuiguo.contacts.client;

import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel;
import com.luhuiguo.contacts.client.ui.Loading;

public class LoadingStatus implements LoadingIndicator, ResizeHandler {

    private PopupPanel popup;

    public LoadingStatus(String loadingMsg) {
        popup = new Loading(loadingMsg);

        placeIndicator();  
        Window.addResizeHandler(this);
    }

    @Override
    public void show() {
        popup.center();
        //popup.show();
    }

    @Override
    public void hide() {
        popup.hide();
    }


    @Override
    public void onResize(ResizeEvent event) {
        placeIndicator();

    }

    private void placeIndicator() {
        //popup.setPopupPosition(Window.getClientWidth() - 150, 10);
        //popup.center();
    }

}
